package com.samp.bblock.core.web.util;

import javax.servlet.ServletRequest;

import org.springframework.http.MediaType;
import org.springframework.util.StringUtils;


public class ContentTypeUtil {
	
	public MediaType getMediaType(ServletRequest request){
		String contentType = request.getContentType();
		if( !StringUtils.hasText(contentType) ){
			contentType = "*";
		}
		if( StringUtils.hasText(contentType) ){
			return MediaType.parseMediaType(contentType);
		}else{
			return null;
		}
	}

}
